$(function(){
  var moreLink = ["[展开]","[收缩]"];
  var box_height = '400px';

  $('.box .act a').click(function(){
    var $t = $(this);
    var isExtend = $t.data('extend');
    var $m = $t.parents('.box').find('.more');
    $t.text(moreLink[isExtend? 0:1]);
    if(isExtend){
      if($t.data('tm')){
        clearTimeout($t.data('tm'));
        $t.data('tm',null);
      }
      $m.hide();
      $t.parents('.box').css('height',box_height);
    }else{
      $m.show();
      $t.parents('.box').css('height','auto');

      var tm = setTimeout(function(){
        $t.data('tm',null);
        $m.hide();
        $t.parents('.box').css('height',box_height);
        $t.data('extend',false);
        $t.text(moreLink[0]);
      },30000);
      $t.data("tm",tm);
    }
    $t.data('extend',!isExtend);
  });
});